<?php
/*=============================================================================
|| ##################################################################
||	phpFoX Konsort
|| ##################################################################
||
||	Copyright		: (C) 2005-2007 PHPFOX Limited a Reality Fox Creation
||	Contact			: info@phpfox.com
||
||	- phpFoX and all of its source code and files are protected by Copyright Laws.
||
||	- The license for phpFoX permits you to install this software on a single domain (.com, .org, .net, etc.).
||
||	- You may also not remove this copyright screen which shows the copyright information and credits for phpFoX (RealityFOX Creations).
||
||	- phpFoX Konsort is NOT a FREE software - http://www.phpfox.com/license/
||
|| ##################################################################
=============================================================================*/

/* $File: ./site/public/index.php, $Author:  $ */

$oTpl = &App::getTemplate();

$bIsMember = App::getUser('user');
$bVideoOn = App::checkUserAccess('video', array('full', 'read_only'), false);

if ($bIsMember)
{
	$bIncludeChat = App::getParam('show_shoutbox');
	
	App::loadAjax(($bVideoOn ? array('Video', (!$bIncludeChat ? 'Shoutbox' : '')) : array('Shoutbox')), array(
		($bVideoOn ? 'latestVideos' : ''),
		(!$bIncludeChat ? 'getShoutboxMessages' : ''),
		(!$bIncludeChat ? 'addShoutOut' : '')
	), true);
}

if (!$bIsMember)
{
	$oDb =& Database::get();
   	$aItems = $oDb->getRows("
   		SELECT 
   			v.vid_id, v.vid_title, u.user 
   		FROM ". App::getT('videos') ." AS v
   			JOIN ". App::getT('user') ." AS u ON(v.vid_userid = u.id)
   		ORDER BY v.vid_time DESC LIMIT 0,3
   	");
}

$oTpl->assignSrc(array(
    'bShowSiteStat' => App::getSetting('show_stats'),
    'aItems' => (!$bIsMember ? $aItems : ''),
    'bIsSignup'     => !App::getSetting('section_signup'),
    'bVideoOn'   => $bVideoOn,
    'sShoutBoxData' => ($bIsMember && function_exists('getShoutboxMessages') ? getShoutboxMessages(0, true) : ''),
    'sGImageUrl' => App::getParam('video.image.url'),
    'bNoValidator' => true
));

?>